package com.example.hellodemo.recyclerView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.widget.Toast;

import com.example.hellodemo.R;

public class GrideRecyclerViewActivity extends AppCompatActivity {
    private RecyclerView griderecycleView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gride_recycler_view);
        griderecycleView = findViewById(R.id.grideCycle1);
        griderecycleView.setLayoutManager(new GridLayoutManager(GrideRecyclerViewActivity.this,3));
        griderecycleView.setAdapter(new GrideCyclerViewAdapter(GrideRecyclerViewActivity.this, new GrideCyclerViewAdapter.ItemClick() {
            @Override
            public void onClick(int position) {
                Toast.makeText(GrideRecyclerViewActivity.this,"positon:" + position,Toast.LENGTH_SHORT).show();
            }
        }));
    }
}
